import { createRouter, createWebHistory } from 'vue-router'
import AdminView from '@/views/AdminView.vue'
import SchoolManagement from '@/views/admin/SchoolManagement.vue'
import MatchManagement from '@/views/admin/MatchManagement.vue'
import PlayerManagement from '@/views/admin/PlayerManagement.vue'
import MofangMatch from '@/components/MofangMatch.vue'
import DrawManagementList from '@/views/admin/DrawManagementList.vue'
import DrawManagement from '@/views/admin/DrawManagement.vue'
import ScoreManagementList from '@/views/admin/ScoreManagementList.vue'
import ScoreManagement from '@/views/admin/ScoreManagement.vue'

const routes = [
  {
    path: '/',
    redirect: '/admin'
  },
  {
    path: '/admin',
    component: AdminView,
    children: [
      {
        path: '',
        redirect: '/admin/school'
      },
      {
        path: 'school',
        component: SchoolManagement
      },
      {
        path: 'match',
        component: MatchManagement
      },
      {
        path: 'player',
        component: PlayerManagement
      },
      {
        path: 'draw',
        component: DrawManagementList
      },
      {
        path: 'match/:id/draw',
        name: 'DrawManagement',
        component: DrawManagement
      },
      {
        path: 'score',
        name: 'ScoreManagementList',
        component: ScoreManagementList
      },
      {
        path: 'match/:id/score',
        name: 'ScoreManagement',
        component: ScoreManagement
      }
    ]
  },
  {
    path: '/match/:id',
    name: 'MatchDetail',
    component: MofangMatch
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router